package com.wandian.cqcsk.mvvm.mine.helpandsuggest.mysuggest;

import android.os.Bundle;

import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.mylib.libcore.config.RouterConfig;
import com.mylib.libcore.mvvm.BaseMVVMActivity;
import com.mylib.libcore.utils.StatusBarUtils;
import com.mylib.libcore.utils.UIUtils;
import com.wandian.cqcsk.R;
import com.wandian.cqcsk.adapter.mine.MyCoinHistoryRecycleAdapter;
import com.wandian.cqcsk.adapter.mine.MySuggestRecycleAdapter;
import com.wandian.cqcsk.databinding.ActivityMySuggestHistoryBinding;
import com.wandian.cqcsk.databinding.ActivityMyTxHistoryBinding;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Administrator
 * @date 2019/12/18-14:28
 * @description MySuggestActivity
 **/
@Route(path = RouterConfig.ROUTER_ACTIVITY_MINE_HISTORY)
public class MySuggestActivity extends BaseMVVMActivity<MySuggestViewModel> {
    private ActivityMySuggestHistoryBinding dataBinding;
    private MySuggestRecycleAdapter mySuggestRecycleAdapter;
    @Override
    public void init(Bundle savedInstanceState) {
        dataBinding = DataBindingUtil.setContentView(this, R.layout.activity_my_suggest_history);
        dataBinding.setLifecycleOwner(this);
        dataBinding.setViewModel(mViewModel);
        initViewData();
        initRecycle();
        initClink();
        mViewModel.getSuggestData();
    }
    private void initViewData(){
        //设置状态颜色和字体黑色
        StatusBarUtils.with(this,false)
                .setIsActionBar(false)
                .clearActionBarShadow()
                .setDrawable(getResources().getDrawable(R.drawable.sys_color))
                .init();
        dataBinding.bindSysToolBar.toolBarTvTitle.setText("我的反馈");
        mViewModel.listData.observe(this,listBean->{
            if(!UIUtils.isEmpty(listBean)){
                mySuggestRecycleAdapter.setNewData(listBean);
            }
        });
    }
    private void initClink(){
        dataBinding.bindSysToolBar.toolBarIvBack.setOnClickListener(v ->finish());
    }
    private void  initRecycle(){
        RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this);
        dataBinding.recycle.setLayoutManager(layoutManager);
        mySuggestRecycleAdapter = new MySuggestRecycleAdapter(R.layout.item_my_suggest_style);
        dataBinding.recycle.setAdapter(mySuggestRecycleAdapter);

    }


}
